<ui:composition
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
    <h:form id="frm-event">
        <p:dialog
            id="message"
            header="Event Dialog"
            widgetVar="dlg"
            modal="true"
            resizable="false"
            width="450">
            <h3>#{calendarMB.titleFormat(interviewBean.selectedDate)}</h3>
            <p>
                <strong>#{interviewBean.msgNumber}</strong>
            </p>
            <div class="v-scroll">
                <ui:repeat value="#{interviewBean.lstInterviews}" var="interview">
                    <h:panelGroup rendered="#{accountMB.account.employee == interview.employee
                                              || accountMB.hRGroup}">
                        <div class="border">
                            <div class="event padding-b-t">
                                <div class="title">
                                    <h3>#{interview.employee.firstName} #{interview.employee.lastName} -
                                        #{interview.employee.employeeID}</h3>
                                    <h:link outcome="manage-interview.xhtml"
                                            title="Review"
                                            styleClass="icon-review size-32"
                                            rendered="#{interview.AVStatus!=99}"/>
                                    <h:panelGroup rendered="#{interview.AVStatus==99}">
                                        <h:panelGroup rendered="#{accountMB.hRGroup}"><!-- HR GROUP -->
                                            <h:link outcome="processing-interview.xhtml"
                                                    title="Reschedule"
                                                    styleClass="icon-refresh size-32"
                                                    rendered="#{interview.status==-100}">
                                                <f:param name="id" value="#{interview.interviewID}"/>
                                                <f:param name="type" value="info"/>
                                            </h:link>
                                            <h:link outcome="processing-interview.xhtml"
                                                    title="Change time"
                                                    styleClass="icon-clock size-32"
                                                    rendered="#{interview.status==100
                                                                || interview.status==0}">
                                                <f:param name="id" value="#{interview.interviewID}"/>
                                                <f:param name="type" value="time"/>
                                            </h:link>
                                        </h:panelGroup>
                                        <h:panelGroup rendered="#{accountMB.interviewer}"><!-- INTERVIEWER -->
                                            <h:link outcome="info.xhtml"
                                                    title="Information"
                                                    styleClass="icon-info size-32"/>
                                            <h:link outcome="processing-interview.xhtml"
                                                    title="Change time"
                                                    styleClass="icon-clock size-32"
                                                    rendered="#{interview.status!=1
                                                                and interview.status!=99}">
                                                <f:param name="id" value="#{interview.interviewID}"/>
                                                <f:param name="type" value="time"/>
                                            </h:link>
                                        </h:panelGroup>
                                    </h:panelGroup>
                                </div>
                                <div class="middle">
                                    <h:panelGroup rendered="#{interview.status == 0}">
                                        <div class="cal_day day_red">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == 100}">
                                        <div class="cal_day day_green">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == -100}">
                                        <div class="cal_day day_blue">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == 99}">
                                        <div class="cal_day day_yellow">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == 1}">
                                        <div class="cal_day day_gray">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                </div>
                                <div class="event_content">
                                    <p><strong>Time: </strong>
                                        #{calendarMB.timeFormat(interview.startedTime)}
                                        to #{calendarMB.timeFormat(interview.endedTime)}</p>
                                    <p><strong>Applicant name: </strong> #{interview.applicant.firstName} #{interview.applicant.lastName}</p>
                                    <p><strong>Vacancy: </strong> #{interview.vacancy.title}</p>
                                    <p><strong>Status: </strong> #{interviewBean.statusValue(interview.status)}</p>
                                </div>
                            </div>
                        </div>
                    </h:panelGroup>
                    <h:panelGroup rendered="#{accountMB.account.employee != interview.employee
                                              and accountMB.interviewer}">
                        <div class="border">
                            <div class="event other padding-b-t">
                                <h3>#{interview.employee.firstName} #{interview.employee.lastName} -
                                    #{interview.employee.employeeID}</h3>
                                <div class="middle">
                                    <h:panelGroup rendered="#{interview.status == 0}">
                                        <div class="cal_day day_red">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == 100}">
                                        <div class="cal_day day_green">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == -100}">
                                        <div class="cal_day day_blue">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == 99}">
                                        <div class="cal_day day_yellow">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{interview.status == 1}">
                                        <div class="cal_day day_gray">
                                            <div class="day_heading">#{calendarMB.dayInWeekFormat(interviewBean.selectedDate)}</div>
                                            <div class="day_number">#{calendarMB.dayFormat(interviewBean.selectedDate)}</div>
                                        </div>
                                    </h:panelGroup>
                                </div>
                                <div class="event_content">
                                    <p><strong>Time: </strong>
                                        #{calendarMB.timeFormat(interview.startedTime)}
                                        to #{calendarMB.timeFormat(interview.endedTime)}</p>
                                    <p><strong>Applicant name: </strong> #{interview.applicant.firstName} #{interview.applicant.lastName}</p>
                                    <p><strong>Vacancy: </strong> #{interview.vacancy.title}</p>
                                    <p><strong>Status: </strong> #{interviewBean.statusValue(interview.status)}</p>
                                </div>
                            </div>
                        </div>
                    </h:panelGroup>
                </ui:repeat>
            </div>
        </p:dialog>
    </h:form>
</ui:composition>
